package com.fastloan.mgt.product.basics.controller;

import com.fastloan.mgt.product.basics.model.ProductTemp;
import com.fastloan.mgt.product.basics.service.ProductTempService;
import com.kawins.base.baseabs.BaseController;
import com.kawins.result.ResultEnum;
import com.kawins.result.ResultTo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author chenkai
 *         createTime 2017-11-2017/11/7 14:34
 */
@RestController
@RequestMapping("/api/web/productTemp")
public class ProductTempController extends BaseController<ProductTemp> {
    @Autowired
    private ProductTempService productTempService;

    /**
     * 配置产品ipc
     * @param productTempList
     * @return
     */
    @PostMapping
    public ResultTo pageParameter(@RequestBody List<ProductTemp> productTempList) {
        try {
            return productTempService.pageParameter(productTempList) != null
                    ? new ResultTo() : new ResultTo(ResultEnum.OPERATION_FAILED);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResultTo(ResultEnum.OPERATION_FAILED, e.getMessage());
        }
    }
}
